package com.cmyshare.design.strategyAndFactorySpring;

import java.math.BigDecimal;

/**
 * @version 1.0
 * @Author cmy
 * @Date 2025/10/13 16:26
 * @desc 支付测试类
 */
// 支付测试类
@SpringBootTest
public class PaymentTest {

    @Autowired
    private PaymentService paymentService;

    @Test
    public void testMultiPayment() {
        // 创建支付请求
        PaymentRequest request = new PaymentRequest(new BigDecimal("199.99"), "ORDER_20240520_001");
        request.setUserId("USER_001");
        request.setClientIp("192.168.1.1");

        // 支付宝支付
        PaymentResult alipayResult = paymentService.processPayment("ALIPAY", request);
        System.out.println("支付宝支付结果: " + alipayResult);

        // 微信支付
        PaymentResult wechatResult = paymentService.processPayment("WECHAT", request);
        System.out.println("微信支付结果: " + wechatResult);

        // 银联支付
        PaymentResult unionpayResult = paymentService.processPayment("UNIONPAY", request);
        System.out.println("银联支付结果: " + unionpayResult);
    }
}

